const {Comment} = require('../../model/comment');

module.exports = async (req, res) => {
    //获取客户端传来的信息
    const {content, uid, aid} = req.body;
    //添加到数据库
    await Comment.create({content, uid, aid, time: new Date()});
    //将页面重定向回文章详情页
    res.redirect(`/home/article?id=${aid}`);

};
